<?php

	if(!array_key_exists("email", $_POST)){
		header("Location: index.php");
		exit;
	}
	$clean_email = preg_replace("/[^a-zA-Z0-9@\-_\.\s]/", "", $_POST['email']);
	$msn = '<html>
		<strong>Hi Rob Keller:</strong>
		<br /><br />
		'.$_POST['name'].' has sent an email to you.
		<br /><br />
		<strong>This is the message:</strong>
		<br /><br />
		'.$_POST['message'].'
		</html>';

	$headers = "From: ".$_POST['name']." <".$_POST['email'].">" . "\r\n"; 
	$headers .= 'MIME-Version: 1.0' . "\r\n"; 
	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	$headers .= 'Reply-To: webmaster@example.com' . "\r\n";
	mail("info@pie.edu", "Message From Contact Us Form", $msn, $headers);
	header("Location: index.php");
	exit;
?>